<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@page import="model.UserBean" %>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <title>Pencarian</title>
        <link href="css/style.css" rel="stylesheet"> 
            <link href="css/bootstrap.css" rel="stylesheet"> 

                <script type="text/javascript" src="js/jquery-1.9.1.js"></script>
                <script type="text/javascript">
                   

                    function lookup(inputString) {
                        if (inputString.length === 0) {
                            $('#suggestions').hide();
                        } else {
                            $.post("List.jsp", {queryString: "" + inputString + ""}, function(data) {
                                if (data.length > 0) {
                                    $('#suggestions').show();
                                    $('#autoSuggestionsList').html(data);

                                }
                            });
                        }
                    }
                    function fill(thisValue) {
                        $('#inputString').val(thisValue);
                        setTimeout("$('#suggestions').hide();", 200);
                    }
                </script>
 <%
                        if (session.getAttribute("userName") == null) {

                            RequestDispatcher rd = request.getRequestDispatcher("login.jsp");
                            rd.forward(request, response);
                        }

                        UserBean bean;
                        bean = new UserBean();
                       
                    %>
                </head>
                <body
                    <form method="post" action="CariServlet">

                        <TABLE border="0"width="600px">
                            <TR>
                                <TD width="150px">Masukkan keyword:</TD>
                                <TD>
                                    <INPUT TYPE="text" NAME="namaSenjata" value="<%=bean.getNamaSenjata()%>" size="30" id="inputString" onkeyup="lookup(this.value);" onblur="fill();">
                                    </TR><tr>     
                                    </TD>
                                    <td> <div class="suggestionsBox" id="suggestions" style="display: none;">
                                            <div class="suggestionList" id="autoSuggestionsList">
                                            </div>
                                        </div></td>
                                </TR>


                                <TR>
                                    <TD colspan="2" align="center">

                                        <INPUT TYPE="submit" class="btn btn-primary" value="<%=bean.getAction()%>" name="action"></input>

                                        <a class="btn btn-default" href="ControllerServlet?action=cancel2">Cancel</a>

                                    </TD>

                                </TR>


                                </center>
                                </form>
                                </div>
                                </body>
                                </html>